package ed.hbut.supermarket1.service.impl;

import ed.hbut.supermarket1.entity.Membership;
import ed.hbut.supermarket1.mapper.MembershipMapper;
import ed.hbut.supermarket1.service.MembershipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MembershipImpl implements MembershipService {

    @Autowired
    public MembershipMapper membershipMapper;

    @Override
    public void addMembership(Membership membership) {
        membershipMapper.addMembership(membership);
    }

    @Override
    public List<Membership> getAllMembership() {
        return membershipMapper.getAllMembership();
    }

    @Override
    public Membership getById(int id) {
        return membershipMapper.getById(id);
    }

    @Override
    public void updateMembership(int id, Membership membership) {
        membership.setMembershipID(id);
        membershipMapper.updateMembership(membership);
    }

    @Override
    public void deleteMembership(int id) {
        membershipMapper.deleteMembership(id);
    }
}
